package cn.lyf.stream;

import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Stream;

public class GatherMap<T, R> implements Function<Stream<T>, R> {
    final Collector<? super T, ?, R> collector;

    public GatherMap(Collector collector) {
        this.collector = collector;
    }

    @Override
    public R apply(Stream<T> tStream) {
        return tStream.collect(collector);
    }
}
